{include file="common/header"/}
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">权限组{:lang('list')}</div>
                <div class="layui-card-body">
                    <div class="layui-row">
                        <table class="layui-table" id="list" lay-filter="list"></table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/html" id="toolbarDemo">
    <div class="layui-btn-group">
        <a href="javascript:;" class="layui-btn layui-btn-sm" onclick="xadmin.open('{:lang('add')}','{:url('add')}');"><i class="layui-icon layui-icon-add-circle"></i>{:lang('add')}</a>
    </div>
    
</script>

<script type="text/html" id="action">
    <div class="layui-btn-group">
        <a class="layui-btn layui-btn-xs layui-btn-normal" onclick="xadmin.open('配置规则','{:url('access')}?id={{d.id}}');">配置规则</a>
        <a  class="layui-btn layui-btn-warm layui-btn-xs" onclick="xadmin.open('编辑','{:url('edit')}?id={{d.id}}');">{:lang('edit')}</a>
        {{# if(d.id==1){ }}
        <a class="layui-btn layui-btn-danger layui-btn-xs layui-btn-disabled">{:lang('del')}</a>
        {{# }else{  }}
        <a class="layui-btn layui-btn-danger layui-btn-xs"  data-href="{:url('del')}" lay-event="del">{:lang('del')}</a>
        {{# } }}
    </div>
</script>

<script type="text/html" id="status">
    {{# if(d.id==1){ }}
    <input type="checkbox" disabled name="status" value="{{d.id}}" lay-skin="switch" lay-text="开启|关闭" data-href="{:url('state')}" lay-filter="status" checked>
    {{# }else{  }}
    <input type="checkbox" name="status"  value="{{d.id}}" lay-skin="switch" lay-text="开启|关闭" data-href="{:url('state')}" lay-filter="status" {{ d.status == 1 ? 'checked' : '' }}>
    {{# } }}
</script>

{include file="common/footer"/}
<script>
    var tableIn;
    layui.use(['element','form', 'layer','table'], function () {
        var $ = layui.jquery,
            form = layui.form,
            table = layui.table;
        table.render({
            elem: '#list',
            url: '{:url("index")}',
            method: 'post',
            toolbar: '#toolbarDemo',
            defaultToolbar: [],
            cols: [[
                {checkbox: true, fixed: true},
                {field: 'id', title: 'ID', width: 80, fixed: true, sort: true},
                {field: 'title', title: '组名'},
                {field: 'status', title: '状态', templet:'#status'},
                {field: 'create_time', title: '添加时间', width: 180},
                {field: 'update_time', title: '修改时间', width: 180},
                {title:'操作',width:250, toolbar: '#action',align:"center"},

            ]],
            page:true
        });
    });

</script>